package com.java.star.mall.front.pojo.param;

import com.java.star.mall.common.valid.UpdateGroups;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import java.io.Serializable;

/**
 * 收获地址参数类
 */
@Data
public class AddressParam implements Serializable {

    private static final long serialVersionUID = 6255570923653895498L;

    @ApiModelProperty(value = "id", required = true)
    @NotNull(message = "id不能为空", groups = UpdateGroups.class)
    private Integer id;

    @ApiModelProperty(value = "收件人名", required = true)
    @NotEmpty(message = "收件人不能为空")
    @Size(min = 1, max = 10, message = "收件人姓名不少于1个字，最多10个")
    private String name;

    @ApiModelProperty(value = "收件人手机号", required = true)
    @NotEmpty(message = "手机号不能为空")
    @Pattern(regexp = "^1([34578])\\d{9}$", message = "电话号码格式不正确")
    private String phone;

    @ApiModelProperty(value = "省份")
    @NotEmpty(message = "省份不能为空")
    private String province;

    @ApiModelProperty(value = "城市")
    @NotEmpty(message = "城市不能为空")
    private String city;

    @ApiModelProperty(value = "地区")
    @NotEmpty(message = "地区不能为空")
    private String district;

    @ApiModelProperty(value = "镇/街道")
    @NotEmpty(message = "镇/街道不能为空")
    private String town;

    @ApiModelProperty(value = "地标")
    @NotEmpty(message = "地标不能为空")
    private String landmark;

    @ApiModelProperty(value = "默认地址", required = true, notes = "0非默认 1默认")
    @NotEmpty(message = "默认地址不能为空")
    @Pattern(regexp = "^([01])$", message = "默认地址值不合法")
    private String isDefault;
}
